package com.xframe.domain.e3sp.bu.sale;

import com.xframe.domain.BaseModel;
import com.xframe.domain.e3sp.maindata.SparePartBaseView;
import com.xframe.xdal.core.annotation.AutoFill;
import com.xframe.xdal.core.annotation.XBelongsTo;
import com.xframe.xdal.core.annotation.XColumn;
import com.xframe.xdal.core.annotation.XTable;
import com.xframe.xdal.core.constant.AutoFillType;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;


/**
 * @Description: 订单明细
 * @ClassName: com.xframe.domain.e3sp.bu.sale.OrderDetail
 * @Author: xufeng
 * @CreateTime: 2024/3/10
 *
 **/
@Data
@Accessors(chain=true)
@XTable(value = "bu_t01_order_detail", label = "订单明细",dataSourceCode = "warehouse")
@XBelongsTo(typeName = "com.xframe.domain.e3sp.bu.sale.Order",foreignKey = "orderId",
        targetKey = "orderId",as = "refOrder")
@XBelongsTo(typeName = "com.xframe.domain.e3sp.maindata.SparePartBaseView",foreignKey = "sparePartId",
        targetKey = "sparePartId",as = "refSparePartBaseView")
public class OrderDetail extends BaseModel {

    /**
     * 订单明细ID
     */
    @AutoFill(AutoFillType.Snowflake)
    @XColumn(name = "order_detail_id", primaryKeyFlag = true,desc = "订单明细ID")
    private Long detailId;

    /**
     * 国内订单ID
     */
    @XColumn(name = "order_id",uniqueFlag = true, desc = "国内订单ID")
    private Long orderId;

    /**
     * 备件清单ID
     */
    @XColumn(name = "spare_part_id",uniqueFlag = true, desc = "备件清单ID")
    private Long sparePartId;

    /**
     * 采购价
     */
    @XColumn(name = "procurement_price", desc = "采购价")
    private BigDecimal procurementPrice;

    /**
     * 销售价格
     */
    @XColumn(name = "sale_price", desc = "销售价格")
    private BigDecimal salePrice;

    /**
     * 数量
     */
    @XColumn(name = "num", desc = "数量")
    private Integer num;

    /**
     * SNP
     */
    @XColumn(name = "snp", desc = "SNP")
    private Integer snp;

    /**
     * 现款金额
     */
    @XColumn(name = "cash_amount", desc = "现款金额")
    private BigDecimal cashAmount;

    /**
     * 折扣金额
     */
    @XColumn(name = "discount_amount", desc = "折扣金额")
    private BigDecimal discountAmount;

    /**
     * 总金额
     */
    @XColumn(name = "total_amount", desc = "总金额")
    private BigDecimal totalAmount;

    /**
     * 已分配数量
     */
    @XColumn(name = "meet_num", desc = "已分配数量")
    private Integer meetNum;

    /**
     * 欠拨数量
     */
    @XColumn(name = "owe_num", desc = "欠拨数量")
    private Integer oweNum;

    /**
     * 欠拨删除数量
     */
    @XColumn(name = "owedel_num", desc = "欠拨删除数量")
    private Integer owedelNum;

    /**
     * 销售退回订单明细ID
     */
    @XColumn(name = "return_detail_id", desc = "销售退回订单明细ID")
    private Long returnDetailId;

    /**
     * 欠拨频次
     */
    @XColumn(name = "owe_count", desc = "欠拨频次")
    private Integer oweCount;

    /**
     * 销退数量
     */
    @XColumn(name = "ret_num", desc = "销退数量")
    private Integer retNum;



    /**
     * 状态
     */
    @XColumn(name = "status", desc = "状态")
    private String status;

    /**
     * 订单
     */
    private Order refOrder;
    /**
     * 备件
     */
    private SparePartBaseView refSparePartBaseView;
}
